package servlet;

import dto.CompanyModelDto;

import model.CompanyModel;
import model.NavModel;
import model.NewsModel;
import service.ICommonService;
import service.INewsService;
import service.impl.CommonServiceImpl;
import service.impl.NewsServcieImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet("/news")
public class NewsServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        ICommonService iCommonService =new CommonServiceImpl();
        req.setAttribute("companyModel", iCommonService.getCommonModelDto());
//        req.setAttribute("companyModel", new CompanyModelIo().getCompanyModel());
        //导航
//        req.setAttribute("navList", new NavModelIo().getNavListFromNote());//这是导航数据
        //新闻信息
        INewsService s =new NewsServcieImpl();
        req.setAttribute("titleList", s.getTitleList());
        req.setAttribute("contentList",s.getContentList());


        req.getRequestDispatcher("/jsp/news.jsp").forward(req, resp);
    }
}